<%-- 
    Document   : TCubeHome
    Created on : Sep 27, 2011, 8:01:21 AM
    Author     : Belinda
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList, BusinessLogic.Constants, EntityState.TCubeAccountState" %>
<!DOCTYPE html>
<html>
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      
        <title>TCube Homepage</title>
        <script type="text/javascript" src="../TransactWeb/js/detect_timezone.js"></script>
<script language="javascript" type="text/javascript" src="../TransactWeb/js/jquery-1.6.4.min.js"></script>
        <script language="javascript" type="text/javascript" src="../TransactWeb/js/jquery.form.js"></script>
        <script type="text/javascript" src="../TransactWeb/js/fieldsetCollapse.js"></script>
        <script type="text/javascript" src="../TransactWeb/js/tcubmenu.js"></script>
        <script type="text/javascript" src="../TransactWeb/js/accordion.js"></script>
        <script type="text/javascript" src="../TransactWeb/js/scroller.js"></script>
        <script type="text/javascript" src="../TransactWeb/js/Utilities.js"></script>

        <link rel="stylesheet" type="text/css" href="../TransactWeb/css/gridsys.css" />
        <link rel="stylesheet" type="text/css" href="../TransactWeb/css/reset1.css" />
        <link rel="stylesheet" type="text/css" href="../TransactWeb/css/tcube.css" />
        <link href="../TransactWeb/css/gridsys.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" type="text/css" href="../TransactWeb/css/tcubaccd.css" />
<script type="text/javascript">
	   // Check Session to show relevant menus
           // Be sure to import Utilities.js in the script file	and declare partnerMenu as a servelet element
	   window.onload = showPage('tcubeMenu', 'leftnav');

<%
                    ArrayList data = (ArrayList) request.getAttribute("data");
                    int result = ((Integer) data.get(0)).intValue();
                    if (result == Constants.STATUS_NEW_SESSION) {
                %>
           // If not logged in, use : 
           window.onload = showPage('topMenutcube', 'topmenu');
           //IF logged in use : 
           <%} else { %>
           window.onload = showPage('topMenulogouttcube', 'topmenu');
<% } %>
	   //welcome msg
	    window.onload = showPage('welcomeMenutcube','welcome');

 	    //footer
            window.onload = showPage('tcubeFooter','footer');
</script>
    </head>
    <body>
        <div class="container_12">
            <!-- Header Nav -->
            <div class="grid_3"><img src="../TransactWeb/img/reservation/foodsglogo.png" width="146" height="178" /></div>
            <div class="grid_9 nav">
                <div id="topmenu"></div>
            </div>

            <div class="grid_12">
                <hr size="3" color="#CC6600" />
            </div>


            <!-- End of Header Nav -->
            <!-- Content -->
                <!-----------------------------------------------------------------------------------------------------------------> 
                <%
                    if (result == Constants.STATUS_NEW_SESSION) {
                %>

                <script type="text/javascript">
                    $(document).ready(function () {
                        var tz = jstz.determine_timezone();
                        var jsTz = tz.name();
                        document.TCubeLogin.timezone.value = jsTz;
                    });
                </script>
                <!--Login -->
                <div class="grid_8 push_3 content">
                    <!--Login -->
                    <form action="https://localhost:8181/portal/internal/TCubeLoginStatus" name="TCubeLogin" method="post">
                        <input type="hidden" id="currentURL" name="currentURL" />
                        <input type="hidden" name="timezone" id="timezone"/>
                        <table width="600" border="0" style="padding:10px 0px 10px 0px;">
                            <tr>
                                <td>
                                    Username :
                                </td>
                                <td>
                                    <input name="username" id="username" type="text" /> &nbsp;&nbsp; 
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Password :
                                </td>
                                <td>
                                    <input name="password" id="password" type="password" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input name="login" type="submit" value="Login" />
                                </td>
                            </tr>
                        </table>
                    </form>
                    <!--End Login -->
                </div>


                <%  } else {
                    TCubeAccountState tas = (TCubeAccountState) session.getAttribute("staff");
                %>
                <!-- Welcome Message -->
                <div class="grid_12 welcome">Welcome <%= tas.getUsername()%>!
                    <div id="welcome"></div>
                    
                </div>
                <!-- End Welcome Message-->
                <div class="grid_4">
                    <div id="leftnav"></div>
                </div>
                <div class="grid_8 content">Welcome to TCube Home!</div>
                <%
                    }
                %>
            <!-- End Content -->
            <!-- Footer -->
            <div class="grid_12 footer">
                <div id="footer"></div></div>
            <!-- End Footer-->
        </div>
    </body>
</html>
